package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Scanner scan=new Scanner(System.in);
        FileOutputStream fos=new FileOutputStream("./note.txt",true);
        System.out.println("请输入字符串:");
        String line;
        while(true){
            line = scan.nextLine();
            if("exit".equals(line))
                break;
            fos.write(line.getBytes(StandardCharsets.UTF_8));//将字符串转换为一组字节
        }
        System.out.println("程序退出");
        fos.close();


    }
}
